package com.cnhis.cloudhealth.clidoctorweb.cliupdateadvice;

import java.util.Map;

import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.cnhis.cloudhealth.clinical.hosdoctor.doctororderupdate.service.IDoctororderupdate;
import org.jboss.resteasy.logging.Logger;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;
import com.cnhis.cloudhealth.clinical.clidoctor.cliupdateadvice.service.ICliUpdateAdvice;
import com.cnhis.cloudhealth.commons.Mappers.ModelVo;
import java.util.HashMap;
@Path("cliupdateadvice")
@Component
public class CliUpdateAdviceRest {
	@Reference
	private ICliUpdateAdvice iCliUpdateAdvice;
	Logger log = Logger.getLogger(CliUpdateAdviceRest.class);

	@Reference
	IDoctororderupdate iDoctororderupdate;

	/**
	 * ClinicAdviceDistill_Update
	 * 用于提取可以修改的医嘱记录
	 * @param lCBM01
	 * @param vaa01
	 * @param vaa07
	 * @param bce01
	 * @param bck01
	 * @param acf01
	 * @param lmode
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	@POST
	@Path("clinicadvicedistillupdate")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo clinicAdviceDistillUpdate(
			@FormParam("lCBM01") Long lCBM01,
			@FormParam("vaa01") Long vaa01,
			@FormParam("vaa07") Long vaa07,
			@FormParam("bce01") Long bce01,
			@FormParam("bck01") Integer bck01,
			@FormParam("acf01") Integer acf01,
			@FormParam("lmode") Integer lmode) throws Exception{
		Map map = new HashMap();
		map.put("lCBM01",lCBM01);
		map.put("vaa01",vaa01);
		map.put("vaa07",vaa07);
		map.put("bce01",bce01);
		map.put("bck01",bck01);
		map.put("acf01",acf01);
		map.put("lmode",lmode);
		return iCliUpdateAdvice.clinicAdviceDistillUpdate(map);
	}
	/* ScriptId(7351) */
	/* Description(判断是否有可修改医嘱) */
	/**
	 * 
	 * @param lVAF06 就诊id
	 * @param lVAF04 门诊 1
	 * @param BCE01 员工id
	 * @param CBM01 医嘱单id
	 * @param lType
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("checkupdateadvice")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo checkUpdateAdvice(@FormParam("lVAF06") int lVAF06,
			@FormParam("lVAF04") int lVAF04,
			@FormParam("BCE01") int BCE01,
			@FormParam("CBM01") int CBM01,@FormParam("lType") int lType)throws Exception{
		HashMap map = new HashMap();
		map.put("lVAF06", lVAF06);
		map.put("lVAF04", lVAF04);
		map.put("BCE01", BCE01);
		map.put("CBM01", CBM01);
		map.put("lType", lType);
		return iCliUpdateAdvice.checkUpdateAdvice(map);
	}
	/* ScriptId(7341) */
	/* Description(医嘱保存CA签名) */
	@SuppressWarnings("unchecked")
	@POST
	@Path("savecasign")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo saveCASign(@FormParam("ltxt") String ltxt,@FormParam("ACF01") int ACF01)throws Exception{
		HashMap map = new HashMap();
		map.put("ltxt", ltxt);
		map.put("ACF01", ACF01);
		return iCliUpdateAdvice.saveCASign(map);
	}
	/* ScriptId(6427) */
	/* Description(修改检查处方时，提取对应检查申请信息) */
	/**
	 * 
	 * @param lCBM01 医嘱id
	 * @param ACF01
	 * @return
	 * @throws Exception
	 */
	@SuppressWarnings("unchecked")
	@POST
	@Path("queryrequestexamine")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo queryRequestExamine(@FormParam("lCBM01") int lCBM01,@FormParam("ACF01") int ACF01)throws Exception{
		HashMap map = new HashMap();
		map.put("lCBM01", lCBM01);
		map.put("ACF01", ACF01);
		return iCliUpdateAdvice.queryRequestExamine(map);
	}

	//提取手术人员
    /*getoperatingCrew*/
	@POST
	@Path("getoperatingCrew")
	@Produces({ MediaType.APPLICATION_JSON })
	public ModelVo getoperatingCrew(
			@FormParam("vaf01") Long vaf01
	)throws Exception{
		Map<String,Object> pmap = new HashMap<String,Object>();
		pmap.put("vaf01",vaf01);
		log.info("getoperatingCrew："+pmap);
		return iDoctororderupdate.getoperatingCrew(pmap);
	}
}
